import { computed } from 'vue'
import { useI18n } from 'vue-i18n'
import type { TableColumnsType } from 'ant-design-vue'
import type { DictType } from '@/types/api/config/dictType'
import type { DictData } from '@/types/api/config/dictData'

/**
 * 获取字典类型表格列配置
 * @returns 字典类型表格列配置
 */
export const useTypeTableColumns = () => {
  const { t } = useI18n()
  
  return computed<TableColumnsType<DictType>>(() => [
    {
      title: t('dict.name'),
      dataIndex: 'dictName',
      key: 'dictName',
      width: 180
    },
    {
      title: t('dict.type'),
      dataIndex: 'dictType',
      key: 'dictType',
      width: 180
    },
    {
      title: t('dict.status'),
      dataIndex: 'status',
      key: 'status',
      width: 100
    },
    {
      title: t('common.createTime'),
      dataIndex: 'createTime',
      key: 'createTime',
      width: 180
    },
    {
      title: t('common.remark'),
      dataIndex: 'remark',
      key: 'remark',
      width: 500
    },
    {
      title: t('common.action'),
      key: 'action',
      width: 180,
      fixed: 'right'
    }
  ])
}

/**
 * 获取字典数据表格列配置
 * @returns 字典数据表格列配置
 */
export const useDataTableColumns = () => {
  const { t } = useI18n()
  
  return computed<TableColumnsType<DictData>>(() => [
    {
      title: t('dict.label'),
      dataIndex: 'dictLabel',
      key: 'dictLabel',
      width: 180
    },
    {
      title: t('dict.value'),
      dataIndex: 'dictValue',
      key: 'dictValue',
      width: 180
    },
    {
      title: t('dict.sort'),
      dataIndex: 'dictSort',
      key: 'dictSort',
      width: 100
    },
    {
      title: t('dict.status'),
      dataIndex: 'status',
      key: 'status',
      width: 100
    },
    {
      title: t('dict.cssClass'),
      dataIndex: 'cssClass',
      key: 'cssClass',
      width: 150
    },
    {
      title: t('common.remark'),
      dataIndex: 'remark',
      key: 'remark',
      ellipsis: true
    },
    {
      title: t('common.action'),
      key: 'action',
      width: 150,
      fixed: 'right'
    }
  ])
} 